// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 

package com.yoyo.lib.net.callback;

import android.text.TextUtils;
import com.yoyo.lib.AppException;
import com.yoyo.lib.AppException.ErrorType;
import com.yoyo.lib.net.itf.IProgressListener;
import com.yoyo.lib.utilities.IOUtilities;
import com.yoyo.lib.utilities.JsonParser;

// Referenced classes of package com.stay.lib.net.callback:
//            AbstractCallback

public abstract class JsonCallback<T> extends AbstractCallback<T> {
    @Override
    protected T bindData(String res, IProgressListener task) throws AppException {
        super.bindData(res, task);
        if (!TextUtils.isEmpty(path))
            res = IOUtilities.readFromFile(res);
        if (mReturnType != null) {
            return JsonParser.deserializeByJson(res, mReturnType);
        } else {
            throw new AppException(ErrorType.JsonException, "JsonException",
                    "json return type should be set", null);
        }
    }
}
